import matplotlib.pyplot as plt
import pandas as pd
from datetime import datetime

plt.rcParams['font.sans-serif'] = ['Microsoft YaHei']  # 指定默认字体：解决plot不能显示中文问题
plt.rcParams['axes.unicode_minus'] = False

data = pd.read_csv("./data/content.csv")
time = data['发送时间']
week = time.apply(lambda x: datetime.fromtimestamp(x).strftime("%A"))
week = week.value_counts()

x = week.index.to_list()

# 设置图框的大小
fig = plt.figure(figsize=(10, 6))
plt.title("《夺冠》每周评论数量分析")
plt.xlabel("星期")
plt.ylabel("评论数量")

# 开始绘图
plt.plot(x, week, linestyle='-', linewidth=2, color='green', marker='o', markersize=8, markeredgecolor='black',
         markerfacecolor='red')
fig.autofmt_xdate(rotation=45)

plt.show()
